<script lang="ts" setup>
import { theme } from '@/common/util/theme';
const lang = ref([
    {
        name: '简体中文',
        value: 'zh-CN',
    },
    {
        name: 'English',
        value: 'en',
    },
]);
const settingStore = useSettingStore();
const router = useRouter();

// 切换语言
const { locale } = useI18n();
const handleChangeLang = async (value: any) => {
    locale.value = value;
    settingStore.setLang(value);
    router.back();
};
</script>

<template>
    <div class="full-router">
        <div class="full-inner">
            <page-header :title="$t('setting.setLanguage')"></page-header>

            <div class="cover-content _effect">
                <div class="setting-group">
                    <div
                        :key="item.name"
                        @click="handleChangeLang(item.value)"
                        class="setting-item cursor-pointer"
                        v-for="item in lang"
                    >
                        <div class="title">{{ item.name }}</div>
                        <icon-check v-show="item.value == settingStore.language" :fill="theme.primaryColor" />
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<style lang="scss" scoped>
.setting-group {
    background-color: rgba(0,0,0,0);

    .setting-item {
        padding-left: 15px;
        padding-right: 15px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        height: 60px;
        border-bottom: 1px solid $color-separate;
        .title {
            font-size: 16px;
            line-height: 24px;
            color: hsl(212.7deg 8.45% 57%);
            padding-left: 10px;
        }
        .row-icon {
            color: $color-primary;
        }
    }
}
</style>
@/common/util/theme